package cn.elwy.rcp.ui.explorer;

import java.util.List;

import org.eclipse.jface.viewers.ColumnViewer;
import org.eclipse.swt.events.SelectionEvent;

import cn.elwy.rcp.ui.explorer.core.vo.BuilderModule;
import cn.elwy.rcp.ui.table.listener.TablePaneButtonListener;

public class SelectionOrDeselectListener extends TablePaneButtonListener {

  public SelectionOrDeselectListener() {
  }

  @Override
  @SuppressWarnings("unchecked")
  public void widgetSelected(SelectionEvent e) {
    ColumnViewer tableViewer = tablePane.getTableViewer();
    List<BuilderModule> input = (List<BuilderModule>) tableViewer.getInput();
    for (BuilderModule builderModule : input) {
      builderModule.setBuilder(!builderModule.isBuilder());
    }
    tableViewer.refresh();
    super.widgetSelected(e);
  }
}
